package logic

import (
	"cart_srv/model/redis"
	"context"

	"cart_srv/cart"
	"cart_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartChecksLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartChecksLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartChecksLogic {
	return &CartChecksLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 购物车状态单选
func (l *CartChecksLogic) CartChecks(in *cart.CartChecksRequest) (*cart.CartChecksResponse, error) {
	// todo: add your logic here and delete this line
	redis.CartChecks(int(in.UserId), int(in.UserId), int(in.Checked))
	return &cart.CartChecksResponse{Success: true}, nil
}
